package com.srwl.mytx.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.RemoteViews;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.srwl.mytx.R;
import com.srwl.mytx.utils.GlideLoadUtils;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by wei on 2016/6/7.
 */
@RemoteViews.RemoteView
public class LiveMemberJoinView extends RelativeLayout {
    @BindView(R.id.iv_joinner_icon)
    ImageView iv_joinnerIcon;
    @BindView(R.id.tv_joiner_nick)
    TextView tv_joinnerNick;
    private Context context;


    public LiveMemberJoinView(Context context) {
        super(context);
        this.context = context;
        init(context, null);
    }

    public LiveMemberJoinView(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.context = context;
        init(context, attrs);

    }

    public LiveMemberJoinView(Context context, AttributeSet attrs, int defStyleAttr) {
        this(context, attrs);
        this.context = context;

    }

    private void init(Context context, AttributeSet attrs) {
        LayoutInflater.from(context).inflate(R.layout.widget_live_member_join, this);
        ButterKnife.bind(this);
    }

    public void setJoinnerNick(String nick) {
        this.tv_joinnerNick.setText(nick);
    }

    public void setJoinnerAvatar(String avatarUrl) {
        //Glide.with(getContext()).load(avatarUrl).into(this.iv_joinnerIcon);
        GlideLoadUtils.glideLoad(context, avatarUrl, iv_joinnerIcon);
    }


}
